//
//  GlobalConfig.h
//  DDGoodRoom
//
//  Created by Mi on 16/4/5.
//  Copyright © 2016年 Haofangtong Inc. All rights reserved.
//

//⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️这里只加“工具类”宏-加宏定义者一定要写好注释⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

#ifndef DDGoodRoom_GlobalConfig_h
#define DDGoodRoom_GlobalConfig_h

//---------------------- int型转换为string ----------------------
#define INT_To_STRING(intValue) ([NSString stringWithFormat:@"%d",(int)intValue])
//---------------------- float型转换为string ----------------------
#define FLOAT_To_STRING(floatValue) ([NSString stringWithFormat:@"%.4f",floatValue])
//---------------------- 计算线条宽度 ----------------------
#define CalculateLineHeight(floatValue) (floatValue / [UIScreen mainScreen].scale)

//---------------------- 屏幕宽度 ----------------------
#define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
//---------------------- 屏幕高度 ----------------------
#define SCREENHEIGHTS ([UIScreen mainScreen].bounds.size.height)

#define SCREENHEIGHT (iPhoneX ? ([UIScreen mainScreen].bounds.size.height - 34) : ([UIScreen mainScreen].bounds.size.height))

#define kScaleHeight ([UIScreen mainScreen].bounds.size.width / 375.f)

#define kScaleWidth ([UIScreen mainScreen].bounds.size.width / 320.f)

#define kScaleHeights ([UIScreen mainScreen].bounds.size.height / 667.f)
#define kScale(size) (kUIScaleSize(size))
// 大小转换为像素
#define SIZE2PIXEL(x) ((long)((x)*[UIScreen mainScreen].scale*(SCREENWIDTH>=414?0.87:1)))
// 适配图片地址
#define FIT_IMAGE_URL(url,w,h) [NSString stringWithFormat:@"%@!%ld!%ld",(url),SIZE2PIXEL(w),SIZE2PIXEL(h)]
//---------------------- 获取Window层 ----------------------
#define kYJCurrentWindow          ((UIWindow *)[[UIApplication sharedApplication].windows firstObject])

//---------------------- 适配界面时frame缩放比例 ----------------------
#define kUIScaleSize(ScaleSize) ((ScaleSize)*(kScaleWidth>1.0?1.05:(kScaleWidth<1.0?0.95:1.0)))

//根据以iPhone6尺寸为标准获取适配大小 add by wu on 2019.03.09
#define kView6ScaleSize(ScaleSize) ((ScaleSize)*(kScaleHeight>1.0?1.05:(kScaleHeight<1.0?0.95:1.0)))
#define kFont6ScaleSize(ScaleSize) ((ScaleSize)+(kScaleHeight>1.0?1:(kScaleHeight<1.0?-1:0)))

//---------------------- 适配界面时字体缩放比例 ----------------------
#define kFontScaleSize(ScaleSize) ((ScaleSize)+(kScaleWidth>1.0?1:(kScaleWidth<1.0?-1:0)))

//根据UI大人标注的大小(以iPhone5为标准)获取适配大小 add by Shinson on 2016.08.25
#define kMarkViewSize(MarkSize) kUIScaleSize((MarkSize)/2.0)
#define kMarkFontSize(MarkSize) kFontScaleSize((MarkSize)/2.0+2)
#define kMarkFont(MarkSize) [UIFont systemFontOfSize:kMarkFontSize(MarkSize)]
#define kFont(MarkSize) [UIFont systemFontOfSize:MarkSize]
#define kFontBold(MarkSize) [UIFont boldSystemFontOfSize:MarkSize];
// 三个屏幕尺寸对应的宽度高度 从大到小
#define kLMSScreenFit(L,M,S) ((iPhone6P||SCREENWIDTH>414.0f) ? (L) : ((iPhone6||iPhoneX||SCREENWIDTH>375.0f) ? (M) : (S)))
//
#define kScreenScale_iPhone5 ([UIScreen mainScreen].bounds.size.width/320)

// 主要用来适配iPhoneX底部操作栏高度
#define kIphoneXTabbarHeight(XValue) (iPhoneX ? (XValue + 34) : (XValue))

// 主要用来适配iPhoneX的导航栏
#define kIphoneXNavi(XValue) (iPhoneX ? (XValue + 24) : (XValue))
// 导航栏高度
#define kNaigationBarHeight(isLargeTitle) (isLargeTitle ? (44 + 52) : 44)
// ViewController布局中顶部的高度，包含状态栏和导航栏
#define kTopLayoutHeight(isLargeTitle) (kStatusBarHeight + kNaigationBarHeight(isLargeTitle))
// iPhoneX底部预留的高度
#define kBottomLayoutHeight (iPhoneX ? 34 : 0)

// 相关尺寸
#define kMineViewSize6(Size) ((Size) * kScreenWidthScale6)
#define kScreenWidthScale6   (SCREENWIDTH/375.0f)
#define kScaleRatio (kScreenWidthScale6>1.0?1.1:1.0)
// 适配大小 iPhone6 pt
#define kViewSize6(Size) ((Size)*kScaleRatio)


//---------------------- 安全执行block ----------------------
#define EXECUTE_BLOCK(A,...) if(A){A(__VA_ARGS__);}

//---------------------- 颜色相关 ----------------------------
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#define RANDOMRGBCOLOR [UIColor colorWithRed:(arc4random() % 256)/255.0f green:(arc4random() % 256)/255.0f blue:(arc4random() % 256)/255.0f alpha:1]
// rgb颜色转换(16进制->10进制)
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


#define kClearColor [UIColor clearColor]
//导航栏上文字默认颜色
#define NaviBarWorldColor [UIColor whiteColor]

// -------------------- 安家默认图片 ----------------
#define UUDefaulthousedetails_header [UIImage imageNamed:@"housedetails_headerdefault"]

#define UUDefaultpic_list [UIImage imageNamed:@"defaultpic_list"]

#define UUDefaultpic_list_4x3 [UIImage imageNamed:@"defaultpic_list_4x3"]

#define UUDefault_alert_image [UIImage imageNamed:@"default_alert_image"]

#define MessageImage(x) [UIImage imageNamed:[NSString stringWithFormat:@"MessageModule.bundle/%@", x]]


// -------------------- 安家默认的颜色 ----------------
// 安家主题色（导航栏绿色）

#define UU_THEME_DEFAULTCOLOR_GREEN RGBCOLOR(255, 84, 0)
// 安家主题色（app内部绿色）
#define UU_THEME_DEFAULTCOLOR_INSIDEGREEN RGBCOLOR(255, 84, 0)
// 安家文字颜色（文字灰1）
#define UU_THEME_DEFAULTCOLOR_TEXTGRAY1 [UIColor colorWithRed:128/255.0f green:128/255.0f blue:128/255.0f alpha:1]//RGBCOLOR(128, 128, 128)
// 安家文字颜色（文字灰2）
#define UU_THEME_DEFAULTCOLOR_TEXTGRAY2 [UIColor colorWithRed:170/255.0f green:170/255.0f blue:170/255.0f alpha:1]//RGBCOLOR(170, 170, 170)
// 安家分割线颜色（灰色1）
#define UU_THEME_DEFAULTCOLOR_LINEGRAY1 [UIColor colorWithRed:221/255.0f green:221/255.0f blue:221/255.0f alpha:1]//RGBCOLOR(221, 221, 221)
// 安家默认黑色
#define UU_THEME_DEFAULTCOLOR_TEXTBLACK [UIColor colorWithRed:33/255.0f green:33/255.0f blue:33/255.0f alpha:1]//RGBCOLOR(221, 221, 221)

#define ShareSuccessNoti @"ShareSuccessNoti"

#define AppRealName @"安家"

/*----------------------------- 安家默认的颜色 -------------------------*/
// 以后统一用这个颜色 add by Shinson on 2017.03.24
// 主题色
#define kThemeColor             RGBCOLOR(9, 173, 167)
// 重要的、亮眼的、特别强调的文字颜色(橙色)
#define kBrightTextColor        RGBCOLOR(255,90,31)
// 橘黄色
#define KOrangeColor            RGBCOLOR(255, 205, 22)
// 浅蓝色
#define KLightBlueColor         RGBCOLOR(77, 170, 240)
// 浅绿色
#define KLightGreenColor        RGBCOLOR(27, 201, 100)
// 价格的文字颜色(红色)
#define kPriceTextColor         RGBCOLOR(255, 84, 0)
// 正常的文字颜色(暗黑色)
#define kNormalTextColor        RGBCOLOR(16,29,54)
// 正常的文字颜色(浅黑色)
#define kLightTextColor         RGBCOLOR(142,148,161)
// 提示性的、示意性的、辅助说明的文字颜色(浅灰色)
#define kHintTextColor          RGBCOLOR(130,130,130)
// 可点击的文字颜色
#define kTouchTextColor         RGBCOLOR(142,162,180)
// 亮黄色（服务评价、佣金支付等）
#define kLightYellowColor       RGBCOLOR(255,207,0)
// 浅背景色(暗白色)
#define kLightBgColor           RGBCOLOR(236,236,236)
// 深线条色
#define kDarkLineColor          RGBCOLOR(200,200,200)
// 浅线条色
#define kLightLineColor         RGBCOLOR(236,236,236)
// 白色
#define kAppWhiteColor          RGBCOLOR(255,255,255)


//根据UI大人标注的大小(以iPhone6为标准)获取适配大小 add by Shinson on 2017.03.25
// 适配界面大小
#define kMark6ViewSize(markSize) kUIScaleSize((markSize)/2.0)
// 适配字体大小
#define kMark6FontSize(markSize) kFontScaleSize((markSize)/2.0)
// 适配字体
#define kMark6Font(markSize) [UIFont systemFontOfSize:kMark6FontSize(markSize)]

//----------------------  关于图片 ----------------------------
//LOAD LOCAL IMAGE FILE 读取本地图片
#define LOADIMAGE(file,ext) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:file ofType:ext]]
//DEFINE IMAGE 定义UIImage对象 //imgView.image = IMAGE(@"Default.png");
#define IMAGE(A) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:A ofType:nil]]
//DEFINE IMAGE 定义UIImage对象
#define ImageNamed(_pointer) [UIImage imageNamed:[UIUtil imageName:_pointer]]
//相对iphone5的屏幕宽度比例
#define kSCREENSCALE_iPhone5 [UIScreen mainScreen].bounds.size.width/320
//默认头像
#define kDefaultAgentHeadImage [UIImage imageNamed:@"经纪人头像"]
// ---------------------- 服务器通讯状态值和相关提示语 ----------------------
#define SuccessStatus 1000
#define TokenNoEffectStatus 1013
#define TokenOutOfDateStatus 1003
#define NoNetworkNotifyMessage     @"没有网络"
#define TokenNoEffectNotifyMessage @"登录失效,即将跳转重新登录..."
#define LoadingMessage             @"数据加载中..."
#define LoadSuccessMessage         @"数据加载成功"
#define LoadFailedMessage          @"加载失败，请重试"
#define ParamsError                @"数据异常"
#define ResponseDataException      @"服务器开了个小差，请稍后重试" // 服务器有返回数据，但数据无法解析
#define RequestTimedOut            @"请求超时，请稍后重试" // -1001
#define ServerException            @"网络异常，请稍后重试" // 网络通，但网络层报错
#define NetworkException           @"没有网络，请检查您的网络设置" // 网络不通
#define AccessTokenException       @"由于您长时间未活动，请重新登录"
// ---------------------- 通用描述 ---------------------
#define NoDescribeText            @"这个主人很懒，什么都没写"

// accessToken过期通知
#define AccessTokenExpired   @"AccessTokenTimeOut"

#define VersionCodeNum @"1"

//---------------------- 获取系统版本 ----------------------
#define iOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue])
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])

#define LAZY_WEAK_SELF __weak __typeof(&*self)weakSelf = self;
#define LazyWeakSelf LAZY_WEAK_SELF

/** 是否为iOS7 */
#define iOS7 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) ? YES : NO)

/** 是否为iOS8 */
#define iOS8 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) ? YES : NO)

/** 是否为iOS9 */
#define iOS9 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) ? YES : NO)

/** 是否为iOS10 */
#define iOS10 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) ? YES : NO)

/** 是否为iOS11 */
#define iOS11 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0) ? YES : NO)

#define ENCRYPT_MOBILE(str) [ReqSecurer crypto:@{@"text":(str)?(str):@"", @"key":AES_SECRET}] //加密手机号码
#define DECRYPT_MOBILE(str) ((str).length>11?[ReqSecurer crypto:@{@"text":(str), @"type":@"1", @"key":AES_SECRET}]:(str)) //解密手机号码
// ---------------------- 友盟APPKey ----------------------
#define AES_KEY @"didiAppWeb"

// ----------------------判断是否 Retina屏、设备是否iPhone 5、是否是iPad----------------------
#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

/** 判断是否为iPhone */
#define isiPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

/** 判断是否是iPad */
#define isiPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

/** 判断是否为iPod */
#define isiPod ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"])

/** 设备是否为iPhone 4/4S 分辨率320x480，像素640x960，@2x */
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

/** 设备是否为iPhone 5C/5/5S 分辨率320x568，像素640x1136，@2x */
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

/** 设备是否为iPhone 6 分辨率375x667，像素750x1334，@2x */
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

/** 设备是否为iPhone 6 Plus 分辨率414x736，像素1242x2208，@3x */
#define iPhone6P ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

/** 设备是否为iPhoneX系列 */
#define iPhoneX ((IS_IPHONE_X == YES || IS_IPHONE_Xr == YES || IS_IPHONE_Xs == YES || IS_IPHONE_Xs_Max== YES) ? YES : NO)

/***********屏幕适配*************/
#define KmainScreenWidth [UIScreen mainScreen].bounds.size.width
#define KmainScreenHeiht [UIScreen mainScreen].bounds.size.height

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

#define kSCREEN_MAX_LENGTH (MAX(KmainScreenWidth, KmainScreenHeiht))
#define kSCREEN_MIN_LENGTH (MIN(KmainScreenWidth, KmainScreenHeiht))

// 状态栏高度
#define kStatusBarHeight (iPhoneX ? 44.f : 20.f)
// 导航栏高度
#define kNavigationBarHeight 44.f
// 顶部导航栏高度(状态栏和导航栏的高度)
#define kNavHeight (kStatusBarHeight + kNavigationBarHeight)

#define IS_IPHONE4 (IS_IPHONE && kSCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE5 (IS_IPHONE && kSCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE6 (IS_IPHONE && kSCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE6P (IS_IPHONE && kSCREEN_MAX_LENGTH == 736.0)
#define IS_IPhoneX (KmainScreenWidth == 375.0f) && (KmainScreenHeiht == 812.0f) && IS_IPHONE
#define kBottomSafeHeight ((IS_IPhoneX)?(34):(0))  //距离底部的安全距离
#define kSystemNavHeight 44.0
#define kNavbarHeight (kStatusBarHeight+kSystemNavHeight) //默认的NAVERgationBar 高度


// ---------------------- NSUserDefaults的相关使用 ----------------------
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]
// 存储的对象
#define UserDefaultSetObjectForKey(__VALUE__,__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] setObject:__VALUE__ forKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}
// 取值
#define UserDefaultObjectForKey(__KEY__)  [[NSUserDefaults standardUserDefaults] objectForKey:__KEY__]

// 删除对象
#define UserDefaultRemoveObjectForKey(__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}

// 获得存储的对象
#define UserDefaultSetBoolForKey(__VALUE__,__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] setBool:__VALUE__ forKey:__KEY__];\
[[NSUserDefaults  standardUserDefaults] synchronize];\
}
// 取值
#define UserDefaultBoolForKey(__KEY__)  [[NSUserDefaults standardUserDefaults] boolForKey:__KEY__]

//---------------------- GCD ----------------------
#define GCDWithGlobal(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define GCDWithMain(block) dispatch_async(dispatch_get_main_queue(),block)

//---------------------- 获取Window ----------------------
#define KEYWINDOW [UIApplication sharedApplication].keyWindow

//---------------------- 设备类型 ----------------------
#define DEVICETYPE  @"2" // 1.Android 2.iOS

//---------------------- 客服相关 ----------------------
//#define DIDIID                @"uu_999999999"
#define DIDIID                @"618239"
#define DIDIName              @"客服"
#define DIDIServiceHeaderUrl  @"http://pic.vfanghui.com/pic/HEAD/1_1/SMALL/CD20064157_1.png?imageView&thumbnail=225z225"

//---------------------- 房源详情提示语 ----------------------
#define HousingDetailsTitle   @"主人很懒，什么都没有写。"

//---------------------- 云信相关 ----------------------
#define NTES_USE_CLEAR_BAR - (BOOL)useClearBar{return YES;}

#define NTES_FORBID_INTERACTIVE_POP - (BOOL)forbidInteractivePop{return YES;}
#define CURRENT_DEVICE [UIDevice currentDevice]
// 设备用户名
#define DEVICE_USERNAME [CURRENT_DEVICE name]
// 设备类型名
#define DEVICE_TYPENAME [CURRENT_DEVICE model]
// 设备地方类型名
#define DEVICE_LOCAL_TYPENAME [CURRENT_DEVICE localizedModel]
/* ------------------------ 系统版本 ------------------------ */
// 系统名称
#define SYS_NAME [CURRENT_DEVICE systemName]
// 系统版本
#define SYS_VERSION [CURRENT_DEVICE systemVersion]

// 保存唯一设备id在钥匙串的Key
#define kDeviceIdentifierIdKey  @"deviceIdentifierIdKey"
// 设备唯一标识ID 采用IDFV+KeyChain模式
// 保存唯一标识ID
#define kSaveDeviceIdentifierIdString [DeviceIdentifierManager saveDeviceIdentifierId]
// 获取唯一标识ID
#define kDeviceIdentifierIdString [DeviceIdentifierManager getDeviceIdentifierId]

//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
// 判断iPhone4系列
#define kiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
// 判断iPhone5系列
#define kiPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
// 判断iPhone6系列
#define kiPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
// 判断iphone6+系列
#define kiPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)

// 判断iPhoneX
#define IS_IPHONE_X  ([UIScreen mainScreen].bounds.size.width == 375.f && [UIScreen mainScreen].bounds.size.height == 812.f ? YES : NO)

// 判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen mainScreen].bounds.size.width == 375.f && [UIScreen mainScreen].bounds.size.height == 812.f ? YES : NO)

// 判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen mainScreen].bounds.size.width == 414.f && [UIScreen mainScreen].bounds.size.height == 896.f ? YES : NO)

// 判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen mainScreen].bounds.size.width == 414.f && [UIScreen mainScreen].bounds.size.height == 896.f ? YES : NO)

#define IS_IPhoneX_All ([UIScreen mainScreen].bounds.size.height == 812.f || [UIScreen mainScreen].bounds.size.height == 896.f)

// iPhoneX系列 navBar和tabBar的判断
#define Height_StatusBar ((IS_IPHONE_X == YES || IS_IPHONE_Xr == YES || IS_IPHONE_Xs == YES || IS_IPHONE_Xs_Max== YES) ? 44.0 : 20.0)

#define Height_NavBar ((IS_IPHONE_X == YES || IS_IPHONE_Xr == YES || IS_IPHONE_Xs == YES || IS_IPHONE_Xs_Max == YES) ? 88.0 : 64.0)

#define Height_TabBar ((IS_IPHONE_X == YES || IS_IPHONE_Xr == YES || IS_IPHONE_Xs == YES || IS_IPHONE_Xs_Max == YES) ? 83.0 : 49.0)

//设计图字体
#define kMark6MediumFont(markSize) [UIFont fontWithName:@"PingFangSC-Medium" size:markSize];
#define kMark6SemiboldFont(markSize) [UIFont fontWithName:@"PingFangSC-Semibold" size:markSize];
#define kMark6RegularFont(markSize) [UIFont fontWithName:@"PingFangSC-Regular" size:markSize];
#define kMark6HeavyFont(markSize) [UIFont fontWithName:@"PingFangSC-Heavy" size:markSize];

//#import "DDLog.h"

#pragma mark - tabbarVC状态枚举
typedef NS_ENUM(NSInteger,UUMainTabType) {
    UUHomeVC = 0,           // 首页
    UUMessageVC,            // 消息
    UUMineVC,               // 我的
};

#pragma mark - IM聊天用户状态枚举
typedef enum {
    OrdinaryUser           = 0, // B端用户
    CustomerService        = 1, // 客服
    CEndUserStatus         = 2  // C端用户
} UserMessageStatus;

typedef enum {
    EntrustStatusCancelled      = 0, //已取消
    EntrustStatusOngoing        = 1, //委托中
    EntrustStatusDealt          = 2  //已成交
} ServerEntrustStatus;

typedef enum {
    HouseEntrustServeStatusRefused              = 0, //已拒绝
    HouseEntrustServeStatusPushed               = 1, //已推送
    HouseEntrustServeStatusReceivedOrder        = 2, //已接单
    HouseEntrustServeStatusContacted            = 3, //已联系
    HouseEntrustServeStatusRequestCheckHouse    = 4, //申请房勘
    HouseEntrustServeStatusAgreedCheckHouse     = 5, //同意房勘
    HouseEntrustServeStatusRecordedIntoSystem   = 6, //转入系统
    HouseEntrustServeStatusFinishedCheckHouse   = 7, //房勘完成
    HouseEntrustServeStatusAgreeEntrustHouse    = 9, //同意委托
    
} ServerHouseEntrustServeStatus;

typedef enum {
    CustomEntrustServeStatusRefused             = 0, //已拒绝
    CustomEntrustServeStatusPushed              = 1, //已推送
    CustomEntrustServeStatusReceivedOrder       = 2, //已接单
    CustomEntrustServeStatusLookedHouse         = 3, //已带看
    CustomEntrustServeStatusDealt               = 4, //已成交
    CustomEntrustServeStatusRecommend           = 5  //推荐
} ServerCustomEntrustServeStatus;

typedef enum{
    LocalHousCustType            = 3,  // 公司房客源
    SystemHousCustType           = 4,  // 合作房客源
    SystemExclusiveHousesType    = 5,  // 独家房客源推送
    SystemNameAuthenticationType = 6,  // 实名认证
    SystemLinkageCustomerType    = 7,  // 联动客户
    SystemHTMLType               = 8,  // html或文本
    SystemBiddingType            = 10, // 小区竞价
    SystemHouseCustType          = 14, // 发给B端的房源
    SystemForbiddenType          = 22, // 禁言提醒
    EntrustComplaintType         = 23, // 委托投诉客服消息
    OrderAutoReplyType           = 123, // 抢单自动回复消息
    PropertyHouseType           = 124, // 物业房源
    PropertyCustType            = 125, // 物业客源
    PropertyServiceType         = 140, // C端服务评价的消息
    PhoneCallType               = 133,  // 电话消息 （隐号拨打和直拨产生的消息）


}SystemMessageType; // 消息类型 5：独家房客源推送 6：实名认证 7：联动客户 8:html或文本 10：小区竞价

typedef NS_ENUM(NSInteger, RecordCallLengtgType) {
    CTCType     = 1,        // c2c
    CTBType     = 2,        // c2b
    BTCType     = 3,         // b2c
    BTBType     = 4,         // b2b
    ATCType     = 5,         // a2c 置业顾问-优优
    CTAType     = 6,         // c2a 优优-置业顾问
    CTDType     = 7         // c2d 优优-售楼部
};

typedef enum {
    ColorButton                    = 0, // 有颜色的 同意看房和不看该房
    UNColorButton                  = 1, // 没有颜色的 同意看房和不看该房
    UNColorButtonRefused           = 2, // 没有颜色的 同意看房和不看该房 并且拒绝状态下的
    ColorHousingEvaluationButton   = 3, // 房源评价带颜色
    UNColorHousingEvaluationButton = 4, // 房源评价不带颜色
    FalseHousing                   = 5, // 假房源
    CommissionPayments             = 6, // 佣金支付
    ServiceEvaluation              = 7, // 服务评价
    ClinchDeal                     = 8, // 成交
    HouseShelves                   = 9, // 房源已下架
    DonotFit                       = 10, // 不合适
    Complaints                     = 11, // 投诉下架
    Failure                        = 12, // 委托失效（手动加上的）
    Complaintsing                  = 13, // 投诉中
    FasleHouseShelves              = 14  // 虚假房源已下架
} MessageButtonStatus;

#pragma mark - [服务器端]客源委托(求租/求购)推荐的房源状态枚举
typedef enum {
    CustomEntrustHouseStatusRequestLooking      = 0, // 申请带看
    CustomEntrustHouseStatusAgreedLooking       = 1, // 同意带看
    CustomEntrustHouseStatusRequestComment      = 2, // 邀请带看评价
    CustomEntrustHouseStatusCommented           = 3, // 已带看评价
    CustomEntrustHouseStatusDealt               = 4, // 已成交
    CustomEntrustHouseStatusComplaintsing       = 5, // 投诉中
    CustomEntrustHouseStatusShelves             = 6, // 房源已下架
    CustomEntrustHouseStatusComplaints          = 7, // 虚假房源已下架
    CustomEntrustHouseStatusFailure             = 12 // 委托已失效（手动加上的）

} ServerCustomEntrustHouseStatus;

typedef NS_ENUM(NSInteger, ChatObjectType) {
    AgentType        = 1,        // 经纪人
    ConsultantType   = 2,        // 置业顾问
    CEndUserType     = 3         // C端用户
};

typedef enum : NSUInteger {
    PushTypeActivity,
    PushType_BackGroud,
    PushType_Init,
} PushType;


typedef enum {
    EntrustTypeSale                 = 1, //出售委托
    EntrustTypeRentOut              = 2, //整租委托
    EntrustTypeBuy                  = 3, //求购委托
    EntrustTypeRent                 = 4, //求租委托
    EntrustTypeJointRentOut         = 5, //合租委托
} ServerEntrustType;

typedef enum {
    CaseTypeSale        = 1, // 出售
    CaseTypeLease       = 2, // 整租
    CaseTypeHezu        = 3, // 合租
    CaseTypeNewHouse    = 6, // 新房
    CaseTypeApartment   = 7, // 公寓
    CaseTypeNearby      = 8, // 附近经纪人  公寓合租用于我的收藏
    CaseTypeLVJU        = 9, // 旅居
}CaseType;

typedef NS_ENUM(NSInteger, UMShareType) {
    UMShareTypeWebPage = 0,  //网页
    UMShareTypeImage = 1,    //图片
    UMShareTypeWXMiniProgram   //小程序
};

typedef enum {
    PaySourceWechat             = 1, // 微信支付
    PaySourceAliPay             = 2, // 支付宝支付
} PaySource;

#define kAlipaySafePayResult @"ALIPAYSAFEPAYRESULT"

#define kWeChatPayResult @"WeChatPayResult"

// 支付宝登录回调
#define KaliProcessAuth_V2Result @"aliProcessAuth_V2Result"

// IM自定义类型相关字段
#define UUHousingCustomSencondType  @"UUHousingCustomSencondType"

#define HFTHouseAndCustomMSG  @"HFTHouseAndCustMSG"

#define UUHousingCustomType  @"UUHousingCustomType"

#define KrefreshRedPoint         @"KrefreshRedPoint"

//---------------------- 个推委托各种状态相关 ----------------------
#define KIMENSTRUSTSTASTUS1 @"BROKER_RECEIVE"       // B端抢单消息
#define KIMENSTRUSTSTASTUS2 @"BROKER_CANCEL_ORDER"  // B端取消了订单
#define KIMENSTRUSTSTASTUS3 @"BROKER_RECOM_HOUSE"   // B端给C端推荐了房源
#define KIMENSTRUSTSTASTUS4 @"BROKER_INVITE_EVA"    // B端邀请C端评价
#define KIMENSTRUSTSTASTUS5 @"BROKER_PAY_TIP"       // B端设置完收款后通知C端
#define KIMENSTRUSTSTASTUS6 @"BROKER_RECALL_HOUSE"  // B端撤回房源通知
#define KIMENSTRUSTSTASTUS7 @"BROKER_CANCEL_ORDER"  // B端取消委托通知
#define KIMENTRUSTPAYREWARD @"ENTRUST_B_PAY_ITENT_MONEY"            // B端支付了奖励金
#define KIMENTRUSTCOMLIAINTSFAILURE @"ENTRUST_COMLIAINTS_FAILURE"            // 收到CRM处理的投诉结果（失败）
#define KIMENTRUSTCOMLIAINTSSUCCESS @"ENTRUST_COMLIAINTS_SUCCESS"            // 收到CRM处理的投诉结果（成功）
#define KIMENTRUSTRECEIVECOMPLAINT @"BROKER_COMPLAINT_CUSTER"   // B端发起投诉
#define KIMENTRUSTCOMPLAINTRESULT @"BROKER_COMPLAINT_DEAL_RESULT"// 收到有奖委托投诉的处理结果

typedef void (^loginSuccessBlock) (NSDictionary *value);

#ifdef DEBUG
//static DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
//static DDLogLevel ddLogLevel = DDLogLevelInfo;
#endif

#define SCREEN_Scale_WIDTH_iPhone5  [[UIScreen mainScreen] bounds].size.width/320.f

static inline void method_execute_frequency(id obj ,SEL selecter, NSTimeInterval timeInterval){
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [obj performSelector:selecter withObject:nil afterDelay:0];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeInterval * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            onceToken = 0;
        });
    });
}

#endif
